import Vue from 'vue'
import VueRouter from 'vue-router'
// 导入组件
import home from '../views/Home/index.vue'
import my from '../views/Home/my/index.vue'
import search from '../views/Home/search/index.vue'
import video from '../views/Home/video/index.vue'
import index from '../views/Home/index/index.vue'

Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    redirect: '/index'
  },
  {
    path: '/login',
    component: () => import('../views/login/index.vue')
  },
  {
    path: '/home',
    component: home,
    redirect: '/index',
    children: [
      {
        path: '/index',
        component: index,
        meta: {
          needBar: true
        }
      },
      {
        path: '/info',
        component: () => import('../views/Home/info/index.vue')
      },
      {
        path: '/video',
        component: video,
        meta: {
          needBar: true
        }
      },
      {
        path: '/my',
        component: my,
        meta: {
          needBar: true
        }
      },
      {
        path: '/search',
        component: search,
        meta: {
          needBar: true
        }
      }
    ]
  }
]

const router = new VueRouter({
  routes
})

export default router
